
local meta = FindMetaTable( "Player" );

function meta:AttachProp( model, attachment, stayafterdead )

	local ent = ents.Create( "ep_attachment" );
	ent:SetModel( model );
	ent:SetPlayer( self, attachment );
	--ent:SetAngleOffset( Angle( 0, 45, 0 ) );
	ent:Spawn();
	
	table.insert( self:GetTable().AttachedProps, { Model = model, Attachment = attachment, Entity = ent } );

	ent:GetTable().KeepAfterDeath = stayafterdead;

	return ent;

end

function meta:RemoveAttachmentFrom( attachment )

	for k, v in pairs( self:GetTable().AttachedProps ) do
	
		if( v.Attachment == attachment ) then
		
			v.Entity:Remove();
			self:GetTable().AttachedProps[k] = nil;
		
		end
	
	end

end